/*
 * @Author: your name
 * @Date: 2022-03-09 16:52:21
 * @LastEditTime: 2022-04-18 22:20:43
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue-admin-template\src\api\user.js
 */
import request from '@/utils/request'

// 登录
export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 退出
export function logout() {
  return request({
    url: '/user/logout',
    method: 'get',
  })
}

// 获取当前用户信息
export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

// 获取用户列表
export function getFindAdminAll(data) {
  return request({
    url: '/user/findAllUsers',
    method: 'get',
    params: data,
  })
}

// 新增用户
export function createAdmin(data) {
  return request({
    url: '/user/createUser',
    method: 'post',
    data,
  })
}

// 更新用户
export function updateAdmin(data) {
  return request({
    url: '/user/updateUserById',
    method: 'post',
    data,
  })
}

// 删除用户
export function deleteById(data) {
  return request({
    url: '/user/deleteUserById',
    method: 'delete',
    data,
  })
}
export function baseUserAvatar(data) {
  return request({
    url: '/user/baseUserAvatar',
    method: 'post',
    data,
  })
}
